package Gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.util.LinkedList;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import Main.Defines;
import PlayerManager.Player;

public class GameBoardPanel extends JPanel {

	private static GameBoardPanel ref;
	private Image background;
	private Dimension size;

	private GameBoardPanel() {
		setName("GameBoardPanel");
		// setLayout(new BorderLayout());
		background = new ImageIcon("Images\\gameboard2.jpg").getImage();
		size = new Dimension(background.getWidth(null), background
				.getHeight(null));
		setSize(size);
		setMinimumSize(size);
	}

	public static GameBoardPanel getInstance() {
		if (ref == null) {
			ref = new GameBoardPanel();
		}
		return ref;
	}

	public void update() {
		// TODO move player on board
	}

	public void paintComponent(Graphics g) {
		// draw background

		// maybe set size for image
		g.drawImage(background, 0, 0, null);

		// draw player icon in accordance to background size
		for (int i = 0; i < Defines.PLM.getPlayerList().size(); i++) {
			Defines.PLM.getPlayerList().get(i).DrawPlayer(g,
					background.getHeight(null), background.getWidth(null),
					Defines.GM.getWeeksPerMonth(), Defines.GM.getDaysPerWeek());
		}
	}
	// public static void main ( String[] args ){
	// //GameBoardPanel.getInstance().get
	// }

}
